package hongcaosp.app.android.modle.bean;

import com.alibaba.fastjson.annotation.JSONField;

public class Video implements IVideo {
//    "id": 1,
//            "videoDesc": "视频标题",
//            "videoPath": "http://112.mp4",路径
//		"videoSeconds": 1,
//                "videoWidth": 1,
//                "videoHeight": 1,
//                "coverPath": "http://112.jpg",//封面
//                "commentsCounts": 1, //评论量
//                "likeCounts": 1, //点赞量
//                "playCount": 0, //播放量
//                "forwardCounts": 0,
//                "isLike": 1,//点赞，0是，1否
//                "isCollection": 1，//icon_share_favorite，0是，1否
//                "videoUser": {
//        "id": 1,
//                "image": "http://www.baidu.com/1.jpg",
//                "nickname": "小米",
//                "isMeFollowmTa": 0, //我关注对方  0 是 1 否
//                "taFollowMe": 0  //对方关注我   0 是 1 否


    @JSONField(name = "id")
    private int vid;
    @JSONField(name = "videoDesc")
    private String videoDesc;
    @JSONField(name = "videoPath")
    private String videoPath;
    @JSONField(name = "videoSeconds")
    private long videoSeconds;
    @JSONField(name = "videoWidth")
    private int videoWidth;
    @JSONField(name = "videoHeight")
    private int videoHeight;
    @JSONField(name = "coverPath")
    private String coverPath;
    @JSONField(name = "commentsCounts")
    private int commentsCounts;
    @JSONField(name = "likeCounts")
    private int likeCounts;
    @JSONField(name = "forwardCounts")
    private int forwardCounts;
    @JSONField(name = "playCount")
    private int playCount;
    @JSONField(name = "isLike")
    private boolean isLike;
    @JSONField(name = "isCollection")
    private boolean isCollection;
    @JSONField(name = "videoUser")
    private User videoUser;
    @JSONField(name = "createTime")
    private long createTime;

    public int getVid() {
        return vid;
    }

    @Override
    public long getSize() {
        return 0;
    }

    public void setVid(int vid) {
        this.vid = vid;
    }

    public String getVideoDesc() {
        return videoDesc;
    }

    public void setVideoDesc(String videoDesc) {
        this.videoDesc = videoDesc;
    }

    public String getVideoPath() {
        return videoPath;
    }

    public void setVideoPath(String videoPath) {
        this.videoPath = videoPath;
    }

    public long getVideoSeconds() {
        return videoSeconds;
    }

    public void setVideoSeconds(long videoSeconds) {
        this.videoSeconds = videoSeconds;
    }

    public int getVideoWidth() {
        return videoWidth;
    }

    public void setVideoWidth(int videoWidth) {
        this.videoWidth = videoWidth;
    }

    public int getVideoHeight() {
        return videoHeight;
    }

    public void setVideoHeight(int videoHeight) {
        this.videoHeight = videoHeight;
    }

    public String getCoverPath() {
        return coverPath;
    }

    public void setCoverPath(String coverPath) {
        this.coverPath = coverPath;
    }

    public int getCommentsCounts() {
        return commentsCounts;
    }

    public void setCommentsCounts(int commentsCounts) {
        this.commentsCounts = commentsCounts;
    }

    public long getLikeCounts() {
        return likeCounts;
    }

    public void setLikeCounts(int likeCounts) {
        this.likeCounts = likeCounts;
    }

    public void setPlayCount(int playCount) {
        this.playCount = playCount;
    }

    public boolean isLike() {
        return isLike;
    }

    public void setLike(boolean like) {
        isLike = like;
    }

    public boolean isCollection() {
        return isCollection;
    }

    public void setCollection(boolean collection) {
        isCollection = collection;
    }

    public User getVideoUser() {
        return videoUser;
    }

    public void setVideoUser(User videoUser) {
        this.videoUser = videoUser;
    }

    @Override
    public String getVideoUrl() {
        return videoPath;
    }

    @Override
    public String getVideoImage() {
        return coverPath;
    }

    @Override
    public String getDescrip() {
        return videoDesc;
    }

    public String getAppComments() {
        return videoDesc;
    }

    @Override
    public int getLikeCount() {
        return likeCounts;
    }

    @Override
    public int getCommentCount() {
        return commentsCounts;
    }

    @Override
    public int getPlayCount() {
        return playCount;
    }

    @Override
    public IUser getAuthor() {
        return videoUser;
    }

    @Override
    public boolean isLiked() {
        return isLike;
    }

    public long getCreateTime() {
        return createTime;
    }

    public void setCreateTime(long createTime) {
        this.createTime = createTime;
    }

    public int getForwardCounts() {
        return forwardCounts;
    }

    public void setForwardCounts(int forwardCounts) {
        this.forwardCounts = forwardCounts;
    }
    private float ratio = 0f;
    @Override
    public float getHeightRatio() {
        if (ratio == 0) {
            if (getVideoHeight() == 0 || getVideoWidth() == 0) {
                ratio = (float) (16 / 9.0);
            } else {
                ratio = getVideoHeight() / (float) getVideoWidth();
            }
        }

        return ratio;
    }
}
